package com.jingtai.platform.controller.shop;

import com.jingtai.core.entity.BaseEntity;
import com.jingtai.core.entity.shop.GoodsSpecificationsCustom;
import com.jingtai.platform.service.shop.GoodsSpecificationsCustomService;
import com.jingtai.platform.util.ResultUtil;
import com.jingtai.validate.swagger.CApiParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperationSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 商品规格表
 *
 * @author sunlaiqian
 * @date 2020-12-09 15:39:05
 */
@RestController
@RequestMapping("/platform/goodsspecificationscustom")
@Api(tags = "商品规格自定义表")
public class GoodsSpecificationsCustomController {

    @Autowired
    private GoodsSpecificationsCustomService goodsSpecificationsCustomService;


    @ApiOperation("商品规格表列表查询")
    @GetMapping("/list")
    public ResultUtil aopGoodsSpecificationsList(@CApiParam(name = "page", value = "页数", required = true, cNotEmpty = true, cIntMin = 1) @RequestParam("page") Integer page,
                                                 @CApiParam(name = "limit", value = "每页个数", required = true, cNotEmpty = true) @RequestParam("limit") Integer limit,
                                                 @CApiParam(name = "conditions", value = "查询条件", required = false) @RequestParam("conditions") String conditions) {
        return goodsSpecificationsCustomService.GoodsSpecificationsCustomlist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询goodsSpecificationsCustom实体")
    @GetMapping("/getGoodsSpecificationsCustomById")
    public ResultUtil GetGoodsSpecificationsCustomById(@CApiParam(name = "id", value = "goodsSpecificationsCustom实体ID", required = true, cNotEmpty = true) @RequestParam("id") Long id) {
        return goodsSpecificationsCustomService.getGoodsSpecificationsCustomById(id);
    }


    @ApiOperation("新增goodsSpecificationsCustom实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"goodsSpecificationsCustom.id", "goodsSpecificationsCustom.createTime", "goodsSpecificationsCustom.updateTime", "goodsSpecificationsCustom.deleteFlag"})
    public ResultUtil aopAddGoodsSpecificationsCustom(@RequestBody @Validated({BaseEntity.Create.class}) GoodsSpecificationsCustom goodsSpecificationsCustom) {
        return goodsSpecificationsCustomService.addGoodsSpecificationsCustom(goodsSpecificationsCustom);
    }

    @ApiOperation("编辑goodsSpecificationsCustom实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"goodsSpecificationsCustom.createTime", "goodsSpecificationsCustom.updateTime", "goodsSpecificationsCustom.deleteFlag"})
    public ResultUtil aopEditGoodsSpecificationsCustom(@RequestBody @Validated({BaseEntity.Update.class}) GoodsSpecificationsCustom goodsSpecificationsCustom) {
        return goodsSpecificationsCustomService.editGoodsSpecificationsCustom(goodsSpecificationsCustom);
    }

    @ApiOperation("根据ID删除goodsSpecificationsCustom实体")
    @GetMapping("/delGoodsSpecificationsCustomById")
    public ResultUtil aopDelGoodsSpecificationsCustomById(@CApiParam(name = "id", value = "goodsSpecificationsCustom实体ID", required = true, cNotEmpty = true) @RequestParam("id") Long id) {
        return goodsSpecificationsCustomService.delGoodsSpecificationsCustomById(id);
    }

    @ApiOperation("查询所有的一级分类")
    @GetMapping("/selectGoodsSpecificationsCustomOfOne")
    public ResultUtil aopSelectGoodsSpecificationsCustomOfOne(@CApiParam(name = "goodsCode", value = "商品编码", required = true, cNotEmpty = true) @RequestParam("goodsCode") String goodsCode) {
        return goodsSpecificationsCustomService.selectGoodsSpecificationsCustomOfOne(goodsCode);
    }

    @ApiOperation("查询所有的一级分类和耳机分类")
    @GetMapping("/selectGoodsSpecificationsCustomOfAll")
    public ResultUtil aopSelectGoodsSpecificationsCustomOfAll() {
        return goodsSpecificationsCustomService.selectGoodsSpecificationsCustomOfAll();
    }

}






